<!-- eslint-disable vue/no-mutating-props -->
<template>
    <div class="common-table">
        <el-table :data="tableData" height="98%" stripe>
            <el-table-column 
             v-for="item in tableLabel" 
             :key="item.prop" 
             :label="item.label"
            :width="item.width ? item.width : '200'" 
          
            >
                <template slot-scope="scope">
                    <span style="margin-left:10px;">{{ scope.row[item.prop] }}</span>
                </template>
            </el-table-column>
            <el-table-column label="操作" min-width="180">
                <template slot-scope="scope">
                   <el-button size="mini" @click="handleEdit(scope.row)">编辑</el-button>
                <el-button size="mini" type="danger" @click="handleDelete(scope.row)">删除</el-button>
                </template>
               
            </el-table-column>
        </el-table>
        <div class="pager">
            <el-pagination layout="prev,pager,next" :total="config.total" :current-page.sync="config.page"
                @current-change="changepage" :page-size="20">

            </el-pagination>
        </div>

    </div>
</template>

<script>
export default {
    props: {
        tableData: Array,
        tableLabel: Array,
        config: Object
    }
    ,

    data() {
        return {

        }
    },
    methods: {
        handleEdit(row) {
            this.$emit('edit', row)
        },
        handleDelete(row) {
            this.$emit('del', row)
        },
        changepage(page) {
            this.$emit('changePage', page)
        }
    },
   
}
</script>

<style lang="less" scoped>
.common-table {
    height: 100% ;
    background-color: #fff;
    position: relative;
    margin-left: 31px;
} 
.pager {
        position: absolute;
        // bottom: 0;
        right: 720px;
    }
</style>